import { useHistory } from 'react-router-dom'
import React from 'react'
const validateLogin = (Com) => {
  return function (props) {
    const history = useHistory()
    const token = localStorage.getItem('token')
    if(!token){
      props.showErrorAlert && props.showErrorAlert('你还没有登录')
      history.push('/login')
      return <></>
    }
    return <Com />
  }
}

export default validateLogin